<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.company.ems.model.User" %>
<%
    User user = (User) session.getAttribute("user");
    if (user != null) {
        response.sendRedirect("./dashboard");
        return;
    }
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>员工管理系统 - 登录</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <div class="login-container fade-in">
        <div class="login-header">
            <h2>员工管理系统</h2>
            <p>请登录您的账户</p>
        </div>
        
        <% if (request.getAttribute("error") != null) { %>
            <div class="alert alert-danger">
                <%= request.getAttribute("error") %>
            </div>
        <% } %>
        
        <form action="./login" method="post" class="login-form">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" class="form-control" 
                       placeholder="请输入用户名" required>
            </div>
            
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" name="password" class="form-control" 
                       placeholder="请输入密码" required>
            </div>
            
            <button type="submit" class="btn btn-primary" style="width: 100%;">
                登录
            </button>
        </form>
        
        <div style="margin-top: 20px; text-align: center; color: #6c757d; font-size: 12px;">
            <p>测试账户：admin / admin123</p>
            <p>测试账户：manager / manager123</p>
        </div>
    </div>
</body>
</html>